#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv)
{
	pid_t pid;

	/* fork a child process */
	pid = fork();
	if (pid < 0) {
		/* error occurred */
		fprintf(stderr, "Fork Failed");
		return 1;
	} else if (pid == 0) {
		/* child process */
		execlp("/bin/ls","ls",NULL);
	} else {
		/* parent process */
		/* parent will wait for the child to complete */
		printf("Waited for %d\n", pid);
		wait(NULL);
		printf("Child Complete\n");
	}

	return 0;
}
